[dotnet] Address nullable warnings#15389
[dotnet] Address nullable warnings#15389RenderMichael wants to merge 1 commit intoSeleniumHQ:trunkfrom
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
| var commandSettings = new FulfillRequestCommandSettings() | ||
| { | ||
| RequestId = requestData.RequestId, | ||
| RequestId = requestData.RequestId!, |
There was a problem hiding this comment.
At first glance requestData.RequestId should not be nullable?
There was a problem hiding this comment.
RequestId can be null in one specific circumstance: when a user creates an HttpRequestData themselves.
This only happens in one place, and it can even cause problems. I filed an issue about it: #15380
However, these HttpRequestDatas are known to be created internally, so we know RequestId is not null.
There was a problem hiding this comment.
Good, so requestData.RequestId should not be null. Then I propose to not suppress this in this PR, because of we will definitely forget re-suppress it. Let's try to fix root cause, even if it will be a breaking change.
What I understand, we have 2 ways:
- Slightly adjust public API to require
RequestIDto be not nullable (following standard policy of deprecation), will be a part ofv4 - Entirely revisit public API of
NetworkManagerinv5(how this API looks, how it could look, including renamingStartMonitoringtoStartMonitoringAsync)
@RenderMichael if can manage the 1st way easily with minimal effort, it would be great (as short-term solution before v5).
There was a problem hiding this comment.
That sounds like a much better solution.
All 3 proposed solutions fix the issue (2 is my favorite but breaking, 3 is still good, 1 is the backup which is not a breaking change).
User description
Description
This PR addresses lingering nullability warnings which can be fixed trivially.
Remaining work is contained in #15380 and #15379
Motivation and Context
Types of changes
Checklist
PR Type
Bug fix
Description
Addressed nullable warnings in multiple
Networkclasses.Added null-forgiving operator (
!) toRequestIdassignments.Updated
WebDriverclass to makeNetworkManagernullable.Improved code safety by handling potential nullability issues.
Changes walkthrough 📝
V131Network.cs
Fix nullable warnings in V131Network classdotnet/src/webdriver/DevTools/v131/V131Network.cs
!) toRequestIdassignments.ContinueRequestandAddResponseBodymethods.V132Network.cs
Fix nullable warnings in V132Network classdotnet/src/webdriver/DevTools/v132/V132Network.cs
!) toRequestIdassignments.ContinueRequestandAddResponseBodymethods.V133Network.cs
Fix nullable warnings in V133Network classdotnet/src/webdriver/DevTools/v133/V133Network.cs
!) toRequestIdassignments.ContinueRequestandAddResponseBodymethods.V85Network.cs
Fix nullable warnings in V85Network classdotnet/src/webdriver/DevTools/v85/V85Network.cs
!) toRequestIdassignments.ContinueRequestandAddResponseBodymethods.WebDriver.cs
Update WebDriver class for nullable `NetworkManager`dotnet/src/webdriver/WebDriver.cs
NetworkManagerfield nullable.